package it.iubar.tkdscore;

/**
 *
 * @author borgo
 */
public class Logic {

    public static Integer red_score = 0;
    public static Integer blue_score = 0;    
    public static Integer blue_penalities_1 = 0;
    public static Integer blue_penalities_2 = 0;
    public static Integer red_penalities_1 = 0;
    public static Integer red_penalities_2 = 0;    
    
    public final static long POLLING_DELAY = 40; // ms (polling interval) (it's the thread sleep time)
    public final static long POINT_LEASE_TIME = 3000;
    public final static long MIN_CLICK_TIME_INTERVAL = 500;
    public final static String DEFAULT_BACKGROUND_COLOR = "";
    final public static int RED = 1;
    final public static int BLUE = 2;
    public static int lead_points = 0;
    public static int max_points = 0;
    final public static int PENALITY_WARNING = 1;
    final public static int PENALITY_SEVERE = 2;
    final public static int DEF_JUDGES_NUM = 1;
    final public static int MAX_JUDGES_NUM = 4;
    final public static int DEF_INTERIM_NUM = 1;
    final public static int DEF_LEAD_POINTS = 0;
    final public static int DEF_MAX_POINTS = 0;
    
            

    public static void addOneRandomPointTo(int n) {
        System.out.println("Random number is " + n);
        if (n == Logic.RED) {
            TkdScoreApp.view.addPoint(Logic.RED, 1);
        } else if (n == Logic.BLUE) {
            TkdScoreApp.view.addPoint(Logic.BLUE, 1);
        } else {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    }
    
    

    public static void showBoard() {        
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public static void startTimer() {
        TkdScoreApp.view.startClock();
    }

    public static void pauseTimer() {
        TkdScoreApp.view.pauseClock();
    }

    public static void resetTimer() {
 throw new UnsupportedOperationException("Not yet implemented");
    }

    public static void resetGame() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public static void nextRound() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public static void addPenality(int type, int player) {
        if(player==Logic.RED){
if(type==PENALITY_WARNING){
    red_penalities_1++;
        }else if(type==PENALITY_SEVERE){   
    red_penalities_2++; 
        }
        }else if(player==Logic.BLUE){
            if(type==PENALITY_WARNING){
        blue_penalities_1++;
          }else if(type==PENALITY_SEVERE){ 
    blue_penalities_2++;
         }
        }
    }

    public static int convertPenalitiesToPoints(int player) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public static int checkPointsDifference() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public static int chekPointsLimit(int player) {
        throw new UnsupportedOperationException("Not yet implemented");
    }
} // end class

